home *** CD-ROM | disk | FTP | other *** search
/ 17 Bit Software 6: Level 6 / 17 Bit - Level 6 (1998)(Epic Marketing)[!].iso / quartz / q0429.dms / q0429.adf / libray / libobj / hf.h < prev    next >
C/C++ Source or Header  |  1991-08-08  |  3KB  |  95 lines

  1. /*
  2.  * hf.h
  3.  *
  4.  * Copyright (C) 1989, 1991, Craig E. Kolb
  5.  * All rights reserved.
  6.  *
  7.  * This software may be freely copied, modified, and redistributed
  8.  * provided that this copyright notice is preserved on all copies.
  9.  *
  10.  * You may not distribute this software, in whole or in part, as part of
  11.  * any commercial product without the express consent of the authors.
  12.  *
  13.  * There is no warranty or other guarantee of fitness of this software
  14.  * for any purpose.  It is provided solely "as is".
  15.  *
  16.  * $Id: hf.h,v 4.0 91/07/17 14:38:19 kolb Exp Locker: kolb $
  17.  *
  18.  * $Log:    hf.h,v $
  19.  * Revision 4.0  91/07/17  14:38:19  kolb
  20.  * Initial version.
  21.  * 
  22.  */
  23. #ifndef HF_H
  24. #define HF_H
  25.  
  26. #define GeomHfCreate(f) GeomCreate((GeomRef)HfCreate(f), HfMethods())
  27.  
  28. /*
  29.  * Any height values <= Hf_UNSET is not considered to be part of the
  30.  * height field. Any trianges containing such a vertex will not be
  31.  * rendered.  This allows one to render non-square height fields.
  32.  */
  33. #define HF_UNSET        (-1000.)
  34. /*
  35.  * Number of datapoints in a single cell.  If you've got loads of memory,
  36.  * decrease this number.  The 'optimal' number is quite system-dependent,
  37.  * but something around 20 seems to work well. For systems without much
  38.  * memory, this constant should be greater than or equal to the largest
  39.  * height field which will be rendered, thus making the algorithm
  40.  * non-hierarchical.
  41.  */
  42. #define BESTSIZE        16
  43. /*
  44.  * Size of triangle cache.
  45.  */
  46. #define CACHESIZE        6
  47. /*
  48.  * Used to differentiate between the two triangles used to represent a cell:
  49.  *    a------d
  50.  *      |\     |
  51.  *      | \TRI2|    TRI2 == c-->d-->a-->c
  52.  *      |  \   |
  53.  *      |   \  |
  54.  *    |    \ |
  55.  *      |TRI1 \|    TRI1 == c-->a-->b-->c
  56.  *      b------c
  57.  */
  58. #define TRI1            1
  59. #define TRI2            2
  60.  
  61. typedef struct hfTri {
  62.     Vector v1, v2, v3, norm;
  63.     Float d;
  64.     char type;
  65.     struct hfTri *next, *prev;
  66. } hfTri;
  67.  
  68. typedef struct {
  69.     int len;
  70.     hfTri *head, *tail;
  71. } TriQueue;
  72.  
  73. typedef struct {
  74.     float **data;        /* Altitude points */
  75.     float minz, maxz;
  76.     int size, *lsize;    /* # of points/side */
  77.     int BestSize;         /* "best" division size */
  78.     float iBestSize;    /* inverse of above (for faster computation) */
  79.     int levels;        /* log base BestSize of size */
  80.     float ***boundsmax;    /* high data values at various resolutions. */
  81.     float ***boundsmin;
  82.     float *spacing;
  83.     hfTri hittri, **q;    /* hit triangle and triangle cache */
  84.     int qtail, qsize;    /* end and length of cache */
  85.     Float boundbox[2][3];    /* bounding box of Hf */
  86. } Hf;
  87.  
  88. extern Hf    *HfCreate();
  89. extern int    HfIntersect(), HfEnter(), HfNormal();
  90. extern void    HfBounds(), HfUV(), HfStats();
  91. extern char    *HfName();
  92. extern Methods    *HfMethods();
  93.  
  94. #endif /* HF_H */
  95.